package com.mingye.board;

import com.mingye.model.chess.Box;
import com.mingye.model.chess.Food;
import com.mingye.model.chess.Person;
import com.mingye.model.grid.BaseGrid;
import com.mingye.model.grid.RoadGrid;
import com.mingye.model.grid.WallGrid;

import java.util.ArrayList;

/**
 * 第五关
 *
 * @author daixinyi
 */
public class Round5Board extends Board {

    @Override
    protected void initBoardArr() {
        int row = 8;
        int col = 5;
        boardArr = new BaseGrid[row][col];
        // 0
        int x = 0;
        int y = 0;
        BaseGrid[] grid0 = new BaseGrid[col];
        grid0[0] = new WallGrid(x++, y);
        grid0[1] = new WallGrid(x++, y);
        grid0[2] = new WallGrid(x++, y);
        grid0[3] = new WallGrid(x++, y);
        grid0[4] = new WallGrid(x++, y);
        boardArr[0] = grid0;

        // 1
        x = 0;
        y = 1;
        BaseGrid[] grid1 = new BaseGrid[col];
        grid1[0] = new WallGrid(x++, y);
        grid1[1] = new RoadGrid(x++, y);
        grid1[2] = new RoadGrid(x++, y);
        grid1[3] = new RoadGrid(x++, y);
        grid1[4] = new WallGrid(x++, y);
        boardArr[1] = grid1;

        // 2
        x = 0;
        y = 2;
        BaseGrid[] grid2 = new BaseGrid[col];
        grid2[0] = new WallGrid(x++, y);
        grid2[1] = new RoadGrid(x++, y);
        grid2[2] = new RoadGrid(x++, y);
        grid2[3] = new RoadGrid(x++, y);
        grid2[4] = new WallGrid(x++, y);
        boardArr[2] = grid2;

        // 3
        x = 0;
        y = 3;
        BaseGrid[] grid3 = new BaseGrid[col];
        grid3[0] = new WallGrid(x++, y);
        grid3[1] = new RoadGrid(x++, y);
        grid3[2] = new RoadGrid(x++, y);
        grid3[3] = new RoadGrid(x++, y);
        grid3[4] = new WallGrid(x++, y);
        boardArr[3] = grid3;

        // 4
        x = 0;
        y = 4;
        BaseGrid[] grid4 = new BaseGrid[col];
        grid4[0] = new WallGrid(x++, y);
        grid4[1] = new RoadGrid(x++, y);
        grid4[2] = new RoadGrid(x++, y);
        grid4[3] = new RoadGrid(x++, y);
        grid4[4] = new WallGrid(x++, y);
        boardArr[4] = grid4;

        // 5
        x = 0;
        y = 5;
        BaseGrid[] grid5 = new BaseGrid[col];
        grid5[0] = new WallGrid(x++, y);
        grid5[1] = new RoadGrid(x++, y);
        grid5[2] = new RoadGrid(x++, y);
        grid5[3] = new RoadGrid(x++, y);
        grid5[4] = new WallGrid(x++, y);
        boardArr[5] = grid5;

        // 6
        x = 0;
        y = 6;
        BaseGrid[] grid6 = new BaseGrid[col];
        grid6[0] = new WallGrid(x++, y);
        grid6[1] = new RoadGrid(x++, y);
        grid6[2] = new RoadGrid(x++, y);
        grid6[3] = new RoadGrid(x++, y);
        grid6[4] = new WallGrid(x++, y);
        boardArr[6] = grid6;

        // 7
        x = 0;
        y = 7;
        BaseGrid[] grid7 = new BaseGrid[col];
        grid7[0] = new WallGrid(x++, y);
        grid7[1] = new WallGrid(x++, y);
        grid7[2] = new WallGrid(x++, y);
        grid7[3] = new WallGrid(x++, y);
        grid7[4] = new WallGrid(x++, y);
        boardArr[7] = grid7;

    }

    @Override
    protected void initBox() {
        // 初始化箱子
        boxList = new ArrayList<>();
        Box box1 = new Box(2, 2, this);
        boxList.add(box1);
        Box box2 = new Box(2, 3, this);
        boxList.add(box2);
        Box box3 = new Box(2, 4, this);
        boxList.add(box3);
        Box box4 = new Box(2, 5, this);
        boxList.add(box4);
    }

    @Override
    protected void initFood() {
        // 初始化食物
        foodList = new ArrayList<>();
        Food food1 = new Food(1, 1, this);
        foodList.add(food1);
        Food food2 = new Food(3, 1, this);
        foodList.add(food2);
        Food food3 = new Food(1, 6, this);
        foodList.add(food3);
        Food food4 = new Food(3, 6, this);
        foodList.add(food4);
    }

    @Override
    protected void initPerson() {
        // 初始化人
        person = new Person(2,6, this);
    }
}
